package cn.angleline.cloudhub.easbi.eas.entity

import java.sql.Timestamp
import java.util.*
import javax.persistence.*

@Entity
@Table(name = "T_BG_BGFORM")
data class TBgBgForm(
        @Id
        @Column(name = "FID")
        var fid: String? = null,

        @Column(name = "FCREATORID")
        var fcreatorid: String? = null,

        @Column(name = "FCREATETIME")
        var fcreatetime: Timestamp? = null,

        @Column(name = "FLASTUPDATEUSERID")
        var flastupdateuserid: String? = null,

        @Column(name = "FLASTUPDATETIME")
        var flastupdatetime: Timestamp? = null,

        @Column(name = "FCONTROLUNITID")
        var fcontrolunitid: String? = null,

        @Column(name = "FNAME")
        var fname: String? = null,

        @Column(name = "FNUMBER")
        var fnumber: String? = null,

        @Column(name = "FDESCRIPTION")
        var fdescription: String? = null,

        @Column(name = "FYEAR")
        var fyear: Int? = null,

        @Column(name = "FPERIOD")
        var fperiod: Int? = null,

        @Column(name = "FSTARTDATE")
        var fstartdate: Timestamp? = null,

        @Column(name = "FENDDATE")
        var fenddate: Timestamp? = null,

        @Column(name = "FAUDITORID")
        var fauditorid: String? = null,

        @Column(name = "FTEMPLATEID")
        var ftemplateid: String? = null,

        @Column(name = "FCOMPANYID")
        var fcompanyid: String? = null,

        @Column(name = "FPERIODTYPE")
        var fperiodtype: Int? = null,

        @Column(name = "FPUBLICSTATUS")
        var fpublicstatus: Int? = null,

        @Column(name = "FPUBLISHEDSTATUS")
        var fpublishedstatus: Int? = null,

        @Column(name = "FCOMMITTEDSTATUS")
        var fcommittedstatus: Int? = null,

        @Column(name = "FHANDLESTATUS")
        var fhandlestatus: Int? = null,

        @Column(name = "FSOURCETYPE")
        var fsourcetype: Int? = null,

        @Column(name = "FORGTREEID")
        var forgtreeid: String? = null,

        @Column(name = "FCURRENCYID")
        var fcurrencyid: String? = null,

        @Column(name = "FAUDITEDTIME")
        var fauditedtime: Timestamp? = null,

        @Column(name = "FAUDITEDSTATUS")
        var fauditedstatus: Int? = null,

        @Column(name = "FCHECKEDSTATUS")
        var fcheckedstatus: Int? = null,

        @Column(name = "FDATA")
        @Lob
        var fdata: ByteArray? = null,

        @Column(name = "FADJUSTMAPDATA")
        var fadjustmapdata: ByteArray? = null,

        @Column(name = "FDATASOURCE")
        var fdatasource: Int? = null,

        @Column(name = "FSTATE")
        var fstate: Int? = null,

        @Column(name = "FEXECUTESTATE")
        var fexecutestate: Int? = null,

        @Column(name = "FBGSCHEMEID")
        var fbgschemeid: String? = null,

        @Column(name = "FBGTEMPLATEID")
        var fbgtemplateid: String? = null,

        @Column(name = "FBGPERIODID")
        var fbgperiodid: String? = null,

        @Column(name = "FORGUNITID")
        var forgunitid: String? = null,

        @Column(name = "FBGTYPEID")
        var fbgtypeid: String? = null,

        @Column(name = "FMEASUREUNITID")
        var fmeasureunitid: String? = null,

        @Column(name = "FVERSIONNO")
        var fversionno: Long? = 0,

        @Column(name = "FADJUSTID")
        var fadjustid: String? = null,

        @Column(name = "FTEMPLATELASTUPDATETIME")
        var ftemplatelastupdatetime: Timestamp? = null,

        @Column(name = "FXNUM")
        var fxnum: String? = null,

        @Column(name = "FISCHANGETYPE")
        var fischangetype: Int? = null,

        @Column(name = "FCOURSEORGID")
        var fcourseorgid: String? = null,

        @Column(name = "FCOURSEUSERID")
        var fcourseuserid: String? = null,

        @Column(name = "FCOURSETIME")
        var fcoursetime: Timestamp? = null,

        @Column(name = "FCERTIFICATEUSERID")
        var fcertificateuserid: String? = null,

        @Column(name = "FCERTIFICATETIME")
        var fcertificatetime: Timestamp? = null,

        @Column(name = "FBACKUSERID")
        var fbackuserid: String? = null,

        @Column(name = "FBACKTIME")
        var fbacktime: Timestamp? = null,

        @Column(name = "FSTATEBEFOREAUDIT")
        var fstatebeforeaudit: Int? = null,

        @Column(name = "FBGITEMGROUPID")
        var fbgitemgroupid: String? = null,

        @Column(name = "FRECORD")
        var frecord: Int? = 0,

        @Column(name = "FBGITEMID")
        var fbgitemid: String? = null,

        @Column(name = "FISCONFIRM")
        var fisconfirm: Int? = null

) {
    override fun equals(other: Any?): Boolean {
        if (this === other) return true
        if (javaClass != other?.javaClass) return false

        other as TBgBgForm

        if (fid != other.fid) return false
        if (fcreatorid != other.fcreatorid) return false
        if (fcreatetime != other.fcreatetime) return false
        if (flastupdateuserid != other.flastupdateuserid) return false
        if (flastupdatetime != other.flastupdatetime) return false
        if (fcontrolunitid != other.fcontrolunitid) return false
        if (fname != other.fname) return false
        if (fnumber != other.fnumber) return false
        if (fdescription != other.fdescription) return false
        if (fyear != other.fyear) return false
        if (fperiod != other.fperiod) return false
        if (fstartdate != other.fstartdate) return false
        if (fenddate != other.fenddate) return false
        if (fauditorid != other.fauditorid) return false
        if (ftemplateid != other.ftemplateid) return false
        if (fcompanyid != other.fcompanyid) return false
        if (fperiodtype != other.fperiodtype) return false
        if (fpublicstatus != other.fpublicstatus) return false
        if (fpublishedstatus != other.fpublishedstatus) return false
        if (fcommittedstatus != other.fcommittedstatus) return false
        if (fhandlestatus != other.fhandlestatus) return false
        if (fsourcetype != other.fsourcetype) return false
        if (forgtreeid != other.forgtreeid) return false
        if (fcurrencyid != other.fcurrencyid) return false
        if (fauditedtime != other.fauditedtime) return false
        if (fauditedstatus != other.fauditedstatus) return false
        if (fcheckedstatus != other.fcheckedstatus) return false
        if (!Arrays.equals(fdata, other.fdata)) return false
        if (!Arrays.equals(fadjustmapdata, other.fadjustmapdata)) return false
        if (fdatasource != other.fdatasource) return false
        if (fstate != other.fstate) return false
        if (fexecutestate != other.fexecutestate) return false
        if (fbgschemeid != other.fbgschemeid) return false
        if (fbgtemplateid != other.fbgtemplateid) return false
        if (fbgperiodid != other.fbgperiodid) return false
        if (forgunitid != other.forgunitid) return false
        if (fbgtypeid != other.fbgtypeid) return false
        if (fmeasureunitid != other.fmeasureunitid) return false
        if (fversionno != other.fversionno) return false
        if (fadjustid != other.fadjustid) return false
        if (ftemplatelastupdatetime != other.ftemplatelastupdatetime) return false
        if (fxnum != other.fxnum) return false
        if (fischangetype != other.fischangetype) return false
        if (fcourseorgid != other.fcourseorgid) return false
        if (fcourseuserid != other.fcourseuserid) return false
        if (fcoursetime != other.fcoursetime) return false
        if (fcertificateuserid != other.fcertificateuserid) return false
        if (fcertificatetime != other.fcertificatetime) return false
        if (fbackuserid != other.fbackuserid) return false
        if (fbacktime != other.fbacktime) return false
        if (fstatebeforeaudit != other.fstatebeforeaudit) return false
        if (fbgitemgroupid != other.fbgitemgroupid) return false
        if (frecord != other.frecord) return false
        if (fbgitemid != other.fbgitemid) return false
        if (fisconfirm != other.fisconfirm) return false

        return true
    }

    override fun hashCode(): Int {
        var result = fid?.hashCode() ?: 0
        result = 31 * result + (fcreatorid?.hashCode() ?: 0)
        result = 31 * result + (fcreatetime?.hashCode() ?: 0)
        result = 31 * result + (flastupdateuserid?.hashCode() ?: 0)
        result = 31 * result + (flastupdatetime?.hashCode() ?: 0)
        result = 31 * result + (fcontrolunitid?.hashCode() ?: 0)
        result = 31 * result + (fname?.hashCode() ?: 0)
        result = 31 * result + (fnumber?.hashCode() ?: 0)
        result = 31 * result + (fdescription?.hashCode() ?: 0)
        result = 31 * result + (fyear ?: 0)
        result = 31 * result + (fperiod ?: 0)
        result = 31 * result + (fstartdate?.hashCode() ?: 0)
        result = 31 * result + (fenddate?.hashCode() ?: 0)
        result = 31 * result + (fauditorid?.hashCode() ?: 0)
        result = 31 * result + (ftemplateid?.hashCode() ?: 0)
        result = 31 * result + (fcompanyid?.hashCode() ?: 0)
        result = 31 * result + (fperiodtype ?: 0)
        result = 31 * result + (fpublicstatus ?: 0)
        result = 31 * result + (fpublishedstatus ?: 0)
        result = 31 * result + (fcommittedstatus ?: 0)
        result = 31 * result + (fhandlestatus ?: 0)
        result = 31 * result + (fsourcetype ?: 0)
        result = 31 * result + (forgtreeid?.hashCode() ?: 0)
        result = 31 * result + (fcurrencyid?.hashCode() ?: 0)
        result = 31 * result + (fauditedtime?.hashCode() ?: 0)
        result = 31 * result + (fauditedstatus ?: 0)
        result = 31 * result + (fcheckedstatus ?: 0)
        result = 31 * result + (fdata?.let { Arrays.hashCode(it) } ?: 0)
        result = 31 * result + (fadjustmapdata?.let { Arrays.hashCode(it) } ?: 0)
        result = 31 * result + (fdatasource ?: 0)
        result = 31 * result + (fstate ?: 0)
        result = 31 * result + (fexecutestate ?: 0)
        result = 31 * result + (fbgschemeid?.hashCode() ?: 0)
        result = 31 * result + (fbgtemplateid?.hashCode() ?: 0)
        result = 31 * result + (fbgperiodid?.hashCode() ?: 0)
        result = 31 * result + (forgunitid?.hashCode() ?: 0)
        result = 31 * result + (fbgtypeid?.hashCode() ?: 0)
        result = 31 * result + (fmeasureunitid?.hashCode() ?: 0)
        result = 31 * result + (fversionno?.hashCode() ?: 0)
        result = 31 * result + (fadjustid?.hashCode() ?: 0)
        result = 31 * result + (ftemplatelastupdatetime?.hashCode() ?: 0)
        result = 31 * result + (fxnum?.hashCode() ?: 0)
        result = 31 * result + (fischangetype ?: 0)
        result = 31 * result + (fcourseorgid?.hashCode() ?: 0)
        result = 31 * result + (fcourseuserid?.hashCode() ?: 0)
        result = 31 * result + (fcoursetime?.hashCode() ?: 0)
        result = 31 * result + (fcertificateuserid?.hashCode() ?: 0)
        result = 31 * result + (fcertificatetime?.hashCode() ?: 0)
        result = 31 * result + (fbackuserid?.hashCode() ?: 0)
        result = 31 * result + (fbacktime?.hashCode() ?: 0)
        result = 31 * result + (fstatebeforeaudit ?: 0)
        result = 31 * result + (fbgitemgroupid?.hashCode() ?: 0)
        result = 31 * result + (frecord ?: 0)
        result = 31 * result + (fbgitemid?.hashCode() ?: 0)
        result = 31 * result + (fisconfirm ?: 0)
        return result
    }

}